function mxXmlRequest(url, params, method, async, username, password)
{
	this.url = url;
	this.params = params;
	this.method = method || 'POST';
	this.async = (async != null) ? async : true;
	this.username = username;
	this.password = password;
};
mxXmlRequest.prototype.url = null;
mxXmlRequest.prototype.params = null;
mxXmlRequest.prototype.method = null;
mxXmlRequest.prototype.async = null;
mxXmlRequest.prototype.username = null;
mxXmlRequest.prototype.password = null;
mxXmlRequest.prototype.request = null;
mxXmlRequest.prototype.isReady = function()
{
	return this.request.readyState == 4;
}
mxXmlRequest.prototype.getDocumentElement = function()
{
	var doc = this.getXml();

	if (doc != null)
	{
		return doc.documentElement;
	}
	return null;
};
mxXmlRequest.prototype.getXml = function()
{
	var xml = this.request.responseXML;

	if (xml == null || xml.documentElement == null)
	{
		xml = mxUtils.parseXml(this.request.responseText);
	}
	return xml;
};
mxXmlRequest.prototype.getText = function()
{
	return this.request.responseText;
};
mxXmlRequest.prototype.getStatus = function()
{
	return this.request.status;
};
mxXmlRequest.prototype.create = function()
{
	if (window.XMLHttpRequest)
	{
		return function()
		{
			return new XMLHttpRequest();
		};
	}
	else if (typeof (ActiveXObject) != "undefined")
	{
		return function()
		{
			return new ActiveXObject("Microsoft.XMLHTTP");
		};
	}
}();
mxXmlRequest.prototype.send = function(onload, onerror)
{
	this.request = this.create();

	if (this.request != null)
	{
		var self = this;
		this.request.onreadystatechange = function()
		{
			if (self.isReady())
			{
				if (onload != null)
				{
					onload(self);
				}
			}
		}
		this.request.open(this.method, this.url, this.async, this.username, this.password);
		this.setRequestHeaders(this.request, this.params);
		this.request.send(this.params);
	}
};
mxXmlRequest.prototype.setRequestHeaders = function(request, params)
{
	if (params != null)
	{
		request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	}
};
mxXmlRequest.prototype.simulate = function(doc, target)
{
	doc = doc || document;
	var old = null;

	if (doc == document)
	{
		old = window.onbeforeunload;
		window.onbeforeunload = null;
	}
	var form = doc.createElement('form');
	form.setAttribute('method', this.method);
	form.setAttribute('action', this.url);

	if (target != null)
	{
		form.setAttribute('target', target);
	}
	form.style.display = 'none';
	form.style.visibility = 'hidden';
	var pars = (this.params.indexOf('&') > 0) ? this.params.split('&') : this.params.split();

	for (var i = 0; i < pars.length; i++)
	{
		var pos = pars[i].indexOf('=');

		if (pos > 0)
		{
			var name = pars[i].substring(0, pos);
			var value = pars[i].substring(pos + 1);
			var textarea = doc.createElement('textarea');
			textarea.setAttribute('name', name);
			value = value.replace(/\n/g, '&#xa;');
			var content = doc.createTextNode(value);
			textarea.appendChild(content);
			form.appendChild(textarea);
		}
	}
	doc.body.appendChild(form);
	form.submit();
	doc.body.removeChild(form);

	if (old != null)
	{
		window.onbeforeunload = old;
	}
};